6 . "$_EXEC/cgilite/logging.sh"
7 . "$_EXEC/cgilite/cgilite.sh"
8 . "$_EXEC/cgilite/session.sh"
9 . "$_EXEC/cgilite/storage.sh"
11 LOCATION="$(PATH "$PATH_INFO")"
12 LOCATION="${LOCATION#/}"
13 LOCATION="${LOCATION%%/*}"
15 NICK_REGISTRATION="${NICK_REGISTRATION:-on}"
18 # COOKIE_NICK_EXPIRE=$((86400 * 14))
19 # REGEISTERED_NICK_EXPIRE=$((86400 * 365))
23 printf '%s\r\n' 'Content-Type: text/html; charset=utf-8' \
24 "Content-Security-Policy: script-src 'none'" \
28 [meta name="viewport" content="width=device-width"]
29 [link rel="stylesheet" type="text/css" href="/webchat.css"]
33 [ "$QUERY_STRING" = settings ] && settings_menu
36 } |"$_EXEC/cgilite/html-sh.sed" -u
40 local nick="$(HTML "${nickname#\?}")"
42 [form #settings method="POST" action="?settings"
43 [hidden "session_key" "%s"]
44 [h1 Settings][a .settings href="?" Close]
47 printf '[p .error %s %s]' "${ERROR%% *}" "$(HTML "${ERROR#.* }")"
50 if [ "$NICK_REGISTRATION" != on -o "$nickname" = '?Guest' ]; then
52 [a .section href="#nick" Nickname]
53 [div #nick .open [input name="nickname" placeholder="%s"][submit "action" "nick" Set Cookie]]
57 [a .section href="#nick" Nickname]
58 [div #nick [input name="nickname" placeholder="%s"][submit "action" "nick" Set Cookie]]
59 [a .section href="#register" Register Nickname]
61 [p Registration will set a permanent Cookie in your Browser.
62 Registration requires neither a password, nor an email address.]
63 [input name="regnick" value="%s"][submit "action" "register" Register]
69 . "$_EXEC/usernick.sh"
73 . "$_EXEC/cgilite/file.sh"
74 FILE "$_EXEC/${LOCATION}"
78 [ "$(COOKIE nick)" -o "$QUERY_STRING" = settings ] || REDIRECT "/$LOCATION?settings#nick"
79 chatfile="$_DATA/${LOCATION}/channel"
84 if [ -d "$_DATA/${LOCATION}" ]; then
85 chatfile="$_DATA/${LOCATION}/?${SESSION_ID}"
93 if [ -d "$_DATA/@${LOCATION#~}" ]; then
94 pubinfo="$_DATA/@${LOCATION#~}/pubinfo"
96 # ToDo Edit / Display of public user information
100 '') yield_page front <<-EOF